﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Automobile.service.Model;
using Automobile.service.BLL;

namespace Automobile.service.UI
{
    public partial class AddPurchase : System.Web.UI.Page
    {
        PurchaseBll bll = new PurchaseBll();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            PurchaseModel p = new PurchaseModel();
           //p.Purchase_Id=Convert.ToInt32(this.TextBox1.Text);
           p.Purchase_curom = Convert.ToInt32(this.TextBox2.Text);
           p.Purchase_date = Convert.ToDateTime(this.TextBox3.Text);
           p.Purchase_State =this.TextBox4.Text.ToString();
           p.SumMoney = Convert.ToInt32(this.TextBox5.Text);
           p.Purchase_Remark = this.TextBox6.Text.ToString();
           p.Supplier_Id = Convert.ToInt32(this.TextBox7.Text);
           p.WareHose_Id = Convert.ToInt32(this.TextBox8.Text);
           p.Employee_Id = Convert.ToInt32(this.TextBox9.Text);
            if (bll.AddPurchase(p) > 0)
            {
                Response.Write("<script>alert('添加成功!');location.href='Purchase.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!');</script>");
            }
        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("Purchase.aspx");
        }
    }
}